﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Battle.View
{
    public class CGuideResourceLoadState : ResourceLoadState
    {
        CGuideBattleViewCtrl cguideViewCtrl
        {
            get
            {
                return this.controller as CGuideBattleViewCtrl;
            }
        }

        public CGuideResourceLoadState(BattleState state, CGuideBattleViewCtrl ctrl):base(state, ctrl)
        {

        }

        public override void Leave()
        {
            base.Leave();
            foreach (var actor in cguideViewCtrl.GetAllActors())
            {
                var firstSkill = actor.Value.GetSkill(SkillType.Skill1);
                if (firstSkill != null)
                {
                    firstSkill.RegistBattleSkillCallback(new CGuideSkillCallback(cguideViewCtrl));
                }
                var secondSkill = actor.Value.GetSkill(SkillType.Skill2);
                if (secondSkill != null)
                {
                    secondSkill.RegistBattleSkillCallback(new CGuideSkillCallback(cguideViewCtrl));
                }
                var ultimateSkill = actor.Value.GetSkill(SkillType.Ultimate);
                if (ultimateSkill != null)
                {
                    ultimateSkill.RegistBattleSkillCallback(new CGuideSkillCallback(cguideViewCtrl));
                }
            }

            cguideViewCtrl.curGuideStep = CGuideBattleViewCtrl.GuideStep.Kirito_FirstSkill_Cast;
        }
    }
}
